package com.sunny.t5;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

/**
 * tarjan求强连通分量
 * 强连通分量变为一个权重node，组成新图
 * 拓扑
 */
public class Main {

    static HashMap<Integer, HashSet<Integer>> map = new HashMap<>();

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        for(int i=0;i<m;i++){
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            if(map.containsKey(a)){
                map.get(a).add(b);
            }else{
                HashSet<Integer> set = new HashSet<>();
                set.add(b);
                map.put(a, set);
            }
        }

        System.out.println(0);


    }

}
